Fix the usage of CFG_xxxABLE_OPTIMIZE variables in Makefiles
authorAkos Kiss <akiss@inf.u-szeged.hu>
Fri, 9 Oct 2015 16:01:13 +0000 (16:01 +0000)
committerAkos Kiss <akiss@inf.u-szeged.hu>
Fri, 9 Oct 2015 16:01:13 +0000 (16:01 +0000)
Until now, there was a CFG_DISABLE_OPTIMIZE that controlled whether
`--release` is passed to cargo during the build, and a
CFG_ENABLE_OPTIMIZE that controlled where `make install` (among
others) looked for the already built cargo executable.
Unfortunately, if none of these were specified, `make all` built a
release cargo but `make install` looked for it under
`$(CFG_TARGET)/debug` (and aborted with "Please run `make` first").
This patch keeps CFG_DISABLE_OPTIMIZE only and uses it
consistently.

Makefile.in

index db8ccb65f30485f704e99e7fdc0b2c819ac5b6f7..b9f98755f621b9a67aea02026a8be356cd464143 100644 (file)
@@ -59,10 +59,10 @@ BIN_TARGETS := $(BIN_TARGETS:src/bin/%.rs=%)
 BIN_TARGETS := $(filter-out cargo,$(BIN_TARGETS))
 
 define DIST_TARGET
-ifdef CFG_ENABLE_OPTIMIZE
-TARGET_$(1) = $$(TARGET_ROOT)/$(1)/release
-else
+ifdef CFG_DISABLE_OPTIMIZE
 TARGET_$(1) = $$(TARGET_ROOT)/$(1)/debug
+else
+TARGET_$(1) = $$(TARGET_ROOT)/$(1)/release
 endif
 DISTDIR_$(1) = $$(TARGET_$(1))/dist
 IMGDIR_$(1) = $$(DISTDIR_$(1))/$$(PKG_NAME)-$(1)-image